﻿@model List<DealKhuyenMaiV2.com.Models.Product>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_MemberGuestLayout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
    <title>Index</title>
    <link href="@Url.Content("/Content/DefaultThemes/Styles/MemberGuestLayoutStyle.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/slides.min.jquery.js")" type="text/javascript"></script>
    <script src="../../Scripts/kkcountdown.js" type="text/javascript"></script>
    <script type="text/javascript">
            function callTimeMini(id) {
                $(function () {
                    $("#kkcount-down-"+id).kkcountdown({
                        dayText: 'ngày ',
                        daysText: ' ngày ',
                        hoursText: ' giờ ',
                        minutesText: ' phút ',
                        secondsText: ' giây',
                        displayZeroDays: false,
                        callback: test,
                        
                    });
                });
                function test() {
                    console.log('KONIEC');
                }
            };
        </script>
</head>
<body>
    <div class="col_left">
       
       
        <!-------Begin box deal nho---------->
        @for (int i = 0; i < Model.Count; i++)
        {
           
            <div class="box_deal_nho">
                <div class="title_deal_nho">
                    <span class="vitri_deal_nho">
                        @Html.ActionLink(Model[i].Catalogy.NameCatalogy, "Filter", "Home", new { IDCatalogy = Model[i].IDCatalogy }, null)
                    </span>
                    @Html.ActionLink(Model[i].NameProduct, "Details", new { idProduct = Model[i].IDProduct })
                </div>
                <div id="img_deal_nho">
                    
                    <img src="@("../../Content/Images/"+((Model[i].Images.Count > 0) ?  Model[i].Images.ElementAt(0).Path : "3.jpg"))" width="320"
                        height="223">
                    <div id="tem_nho">
                        <div class="text_giam_nho">
                            GIẢM</div>
                        <div class="phantram_nho">@Math.Round(Model[i].Discount * 100 / Model[i].Price)%</div>
                    </div>
                    <div id="wrap_tg_phieu">
                        <script>
                            callTimeMini(@i);
                        </script>
                        <div class="thoigian_nho">
                            <span time="@(Math.Round((Model[i].Date_end - new DateTime(1970, 1, 1, 7, 0, 0)).TotalSeconds, 0))" id="kkcount-down-@(i)">
                            </span>
                        </div>
                        <div class="sophieumua_nho">
                            <span class="luotmua_nho">@Model[i].NumberOfPurchased</span> lượt mua</div>
                    </div>
                </div>
                <div id="gia_goc_deal_nho">
                    Giá gốc: @(Model[i].Price)đ<br>
                    Tiết kiệm: @(Model[i].Discount)đ
                    <div id="arrow_nho">
                        <div class="gia_deal_nho">@(Model[i].Price - Model[i].Discount)đ</div>
                        <div class="button_nho">
                            <input type="button" class="btn_mua_nho" onclick="location.href='@Url.Action("ShoppingCart", "Home", new { idProduct = Model[i].IDProduct })'"></div>
                    </div>
                </div>
            </div>
            if (i % 2 == 0)
            {
            <div style="width: 20px; float: left">
                <img src="/Content/DefaultThemes/Images/space.gif" width="20px" height="20px"></div>            
            }
        }
        <!-------END box deal nho---------->
    </div>
</body>
</html>
